<?php
namespace app\admin\models;
use think\Model;
use think\Db;
class Admin extends Model
{
    //use SoftDelete;
   // protected $autoWriteTimestamp = true;
   // protected $deleteTime = 'delete_time';
    //定义主键
    protected $pk = 'id';
    protected $table ='house_admin';
    //指定对应的表明，包括表前缀
    //protected $table ='stu';
    /**
     * 查询
     */
   
    public function index()
    {
        $list = self::where('id','>',0)->paginate(5);
       // print_r($list);die();
        return $list;
    }
    public function add()
    {
        $data=input('param.');
        $cla = new Admin();
        $result = $cla->save($data);
        return $result;

    }

   public function updateById()
    {
        $data=input('param.');
        $cla = new Admin();
        $result = $cla->get($data['id'])->save($data);
        return $result;
    }
    public function updateByOne($id)
    {
        $list = self::get($id);

        return $list;
    }
   
    public function like()
    {
        $res = new Admin();
        if(!empty( input('param.Admin'))){
            $res=self::where("Admin_name",input('param.Admin'));
        }
         $res=$res->paginate(3);
        return $res;
    }
    
    /* 
    
   
     public function adds($file)
    {
         $info=$file->rule('md5')->validate(['size'=>5242880,'ext'=>'jpg,png,gif'])->move('./uploads/');
        $infoname=$info->getSaveName();
        $data=[
        'name' =>input('param.name'),
        'cid' =>input('param.cid'),
        'tel'=>input('param.tel'),
        'sex' =>input('param.sex'),
        'sfid'=>input('param.sfid'),
        'content' =>input('param.content'),
        'image'=>$infoname,
        'datatime'=>time(),
        ];
        $cla = new Stu();
        $results = $cla->save($data);
        $ra=$cla->where($data)->find();
        $data1['jf']=$ra['id'];
        $result = $cla->get($ra['id'])->save($data1);
        return $result;

    }
    
   
    
    public function deleteById($id)
    {

        $result = Stu::destroy($id);//软删除
        return $result;

    }

}
*/
}
?>